package com.itkf.common;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class MyApplicationContext implements ApplicationContextAware {
    private static ApplicationContext Context;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        Context = applicationContext;
    }

    public static <T> Map<String,T> getBeanFromType(Class<T> type) {
        return Context.getBeansOfType(type);
    }

}
